package cn.ygh.bbo.framerwork.web;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * 通用Spring 工具
 */
public class SpringContext implements ApplicationContextAware {

    private static ApplicationContext application=null;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        application=applicationContext;
    }

    public static ApplicationContext getApplication() {
        return application;
    }

    public static <T>T getBean(Class<T>clazz){
        return application.getBean(clazz);
    }


}
